#include<unistd.h>
#pragma once
#include <sys/syscall.h>

namespace CurrentThread
{
    // 线程本地存储
    extern __thread int t_cachedTid;

    void cacheTid();
    
    inline int tid()
    {
        if(__builtin_expect(t_cachedTid == 0,0))
        {
            cacheTid();
        }
        return  t_cachedTid;
    }
}